/*
 * AGENT SHERPA
 *  
 * Assignement 2 of the Agent Oriented Software Engineering Course
 * M.Sc. in Advanced Software Engineering (Part-time)
 * University College Dublin www.ucd.ie
 *
 * Copyright (c) 2007 Chris Walsh, Aidan Morrisy and Iain Hull.
 * All rights reserved.
 */

package org.agentsherpa;

import com.agentfactory.platform.interfaces.Perceptor;


/**
 * Provides access to the Simulator Platform service.
 * 
 * @author iain
 */
public abstract class BasePerceptor extends Perceptor {

    protected SimulatorService getSimulator() throws PerceptorException {
        SimulatorService simulator = (SimulatorService) getService("org.agentsherpa.SimulatorService");
        if (simulator == null) {
            throw new PerceptorException("Cannot access SimulatorService");
        }
        return simulator;
    }
    
    protected LocationModule getLocationModule() throws PerceptorException {
        LocationModule module = (LocationModule) getModuleByName("location");
        if (module == null) {
            throw new PerceptorException("Cannot access LocationModule");
        }
        return module;
    }
    
    protected ControlAgentModule getControlModule() throws PerceptorException {
    	ControlAgentModule module = (ControlAgentModule) getModuleByName("controlagentmodule");
        if (module == null) {
            throw new PerceptorException("Cannot access LocationModule");
        }
        return module;
    }
}